\(\int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx\) [315]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 28, antiderivative size = 58 \[ \int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {2 b B x}{a^2+b^2}-\frac {\left (a-\frac {b^2}{a}\right ) B \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right ) d} \]

[Out]

2*b*B*x/(a^2+b^2)-(a-b^2/a)*B*ln(a*cos(d*x+c)+b*sin(d*x+c))/(a^2+b^2)/d

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 58, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.071, Rules used = {3612, 3611} \[ \int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {2 b B x}{a^2+b^2}-\frac {B \left (a-\frac {b^2}{a}\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )} \]

[In]

Int[((b*B)/a + B*Tan[c + d*x])/(a + b*Tan[c + d*x]),x]

[Out]

(2*b*B*x)/(a^2 + b^2) - ((a - b^2/a)*B*Log[a*Cos[c + d*x] + b*Sin[c + d*x]])/((a^2 + b^2)*d)

Rule 3611

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c/(b*f))
*Log[RemoveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {2 b B x}{a^2+b^2}-\frac {\left (\left (a-\frac {b^2}{a}\right ) B\right ) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{a^2+b^2} \\ & = \frac {2 b B x}{a^2+b^2}-\frac {\left (a-\frac {b^2}{a}\right ) B \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right ) d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.13 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.12 \[ \int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {B \left (4 a b \arctan (\tan (c+d x))+\left (a^2-b^2\right ) \left (\log \left (\sec ^2(c+d x)\right )-2 \log (a+b \tan (c+d x))\right )\right )}{2 a \left (a^2+b^2\right ) d} \]

[In]

Integrate[((b*B)/a + B*Tan[c + d*x])/(a + b*Tan[c + d*x]),x]

[Out]

(B*(4*a*b*ArcTan[Tan[c + d*x]] + (a^2 - b^2)*(Log[Sec[c + d*x]^2] - 2*Log[a + b*Tan[c + d*x]])))/(2*a*(a^2 + b
^2)*d)

Maple [A] (verified)

Time = 0.05 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.47

method result size
derivativedivides \(\frac {B \left (\frac {\frac {\left (a^{2}-b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+2 a b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {\left (a^{2}-b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{2}+b^{2}}\right )}{d a}\) \(85\)
default \(\frac {B \left (\frac {\frac {\left (a^{2}-b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+2 a b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {\left (a^{2}-b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{2}+b^{2}}\right )}{d a}\) \(85\)
norman \(\frac {2 b B x}{a^{2}+b^{2}}+\frac {B \left (a^{2}-b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 a d \left (a^{2}+b^{2}\right )}-\frac {B \left (a^{2}-b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{a d \left (a^{2}+b^{2}\right )}\) \(92\)
parallelrisch \(\frac {4 B a b d x +B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2}-B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) b^{2}-2 B \ln \left (a +b \tan \left (d x +c \right )\right ) a^{2}+2 B \,b^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{2 a d \left (a^{2}+b^{2}\right )}\) \(93\)
risch \(-\frac {x B b}{a \left (i b -a \right )}+\frac {i x B}{i b -a}+\frac {2 i B x a}{a^{2}+b^{2}}-\frac {2 i b^{2} B x}{a \left (a^{2}+b^{2}\right )}+\frac {2 i B a c}{d \left (a^{2}+b^{2}\right )}-\frac {2 i b^{2} B c}{a d \left (a^{2}+b^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B a}{d \left (a^{2}+b^{2}\right )}+\frac {b^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{a d \left (a^{2}+b^{2}\right )}\) \(205\)

[In]

int((b*B/a+B*tan(d*x+c))/(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d/a*B*(1/(a^2+b^2)*(1/2*(a^2-b^2)*ln(1+tan(d*x+c)^2)+2*a*b*arctan(tan(d*x+c)))-(a^2-b^2)/(a^2+b^2)*ln(a+b*ta
n(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.34 \[ \int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {4 \, B a b d x - {\left (B a^{2} - B b^{2}\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, {\left (a^{3} + a b^{2}\right )} d} \]

[In]

integrate((b*B/a+B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(4*B*a*b*d*x - (B*a^2 - B*b^2)*log((b^2*tan(d*x + c)^2 + 2*a*b*tan(d*x + c) + a^2)/(tan(d*x + c)^2 + 1)))/
((a^3 + a*b^2)*d)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.45 (sec) , antiderivative size = 235, normalized size of antiderivative = 4.05 \[ \int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx=\begin {cases} \text {NaN} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a d} & \text {for}\: b = 0 \\- \frac {B}{b d \tan {\left (c + d x \right )} - i b d} & \text {for}\: a = - i b \\- \frac {B}{b d \tan {\left (c + d x \right )} + i b d} & \text {for}\: a = i b \\\frac {x \left (B \tan {\left (c \right )} + \frac {B b}{a}\right )}{a + b \tan {\left (c \right )}} & \text {for}\: d = 0 \\- \frac {2 B a^{2} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} + \frac {B a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{3} d + 2 a b^{2} d} + \frac {4 B a b d x}{2 a^{3} d + 2 a b^{2} d} + \frac {2 B b^{2} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} - \frac {B b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{3} d + 2 a b^{2} d} & \text {otherwise} \end {cases} \]

[In]

integrate((b*B/a+B*tan(d*x+c))/(a+b*tan(d*x+c)),x)

[Out]

Piecewise((nan, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (B*log(tan(c + d*x)**2 + 1)/(2*a*d), Eq(b, 0)), (-B/(b*d*tan(
c + d*x) - I*b*d), Eq(a, -I*b)), (-B/(b*d*tan(c + d*x) + I*b*d), Eq(a, I*b)), (x*(B*tan(c) + B*b/a)/(a + b*tan
(c)), Eq(d, 0)), (-2*B*a**2*log(a/b + tan(c + d*x))/(2*a**3*d + 2*a*b**2*d) + B*a**2*log(tan(c + d*x)**2 + 1)/
(2*a**3*d + 2*a*b**2*d) + 4*B*a*b*d*x/(2*a**3*d + 2*a*b**2*d) + 2*B*b**2*log(a/b + tan(c + d*x))/(2*a**3*d + 2
*a*b**2*d) - B*b**2*log(tan(c + d*x)**2 + 1)/(2*a**3*d + 2*a*b**2*d), True))

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.64 \[ \int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\frac {4 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} - \frac {2 \, {\left (B a^{2} - B b^{2}\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{3} + a b^{2}} + \frac {{\left (B a^{2} - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{3} + a b^{2}}}{2 \, d} \]

[In]

integrate((b*B/a+B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*(4*(d*x + c)*B*b/(a^2 + b^2) - 2*(B*a^2 - B*b^2)*log(b*tan(d*x + c) + a)/(a^3 + a*b^2) + (B*a^2 - B*b^2)*l
og(tan(d*x + c)^2 + 1)/(a^3 + a*b^2))/d

Giac [A] (verification not implemented)

none

Time = 0.36 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.71 \[ \int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\frac {4 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} + \frac {{\left (B a^{2} - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{3} + a b^{2}} - \frac {2 \, {\left (B a^{2} b - B b^{3}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{3} b + a b^{3}}}{2 \, d} \]

[In]

integrate((b*B/a+B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

1/2*(4*(d*x + c)*B*b/(a^2 + b^2) + (B*a^2 - B*b^2)*log(tan(d*x + c)^2 + 1)/(a^3 + a*b^2) - 2*(B*a^2*b - B*b^3)
*log(abs(b*tan(d*x + c) + a))/(a^3*b + a*b^3))/d

Mupad [B] (verification not implemented)

Time = 8.68 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.93 \[ \int \frac {\frac {b B}{a}+B \tan (c+d x)}{a+b \tan (c+d x)} \, dx=-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (B\,b+B\,a\,1{}\mathrm {i}\right )}{2\,d\,\left (a\,b-a^2\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B\,a+B\,b\,1{}\mathrm {i}\right )}{2\,d\,\left (-a^2+a\,b\,1{}\mathrm {i}\right )}-\frac {B\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (a^2-b^2\right )}{a\,d\,\left (a^2+b^2\right )} \]

[In]

int((B*tan(c + d*x) + (B*b)/a)/(a + b*tan(c + d*x)),x)

[Out]

- (log(tan(c + d*x) - 1i)*(B*a*1i + B*b))/(2*d*(a*b - a^2*1i)) - (log(tan(c + d*x) + 1i)*(B*a + B*b*1i))/(2*d*
(a*b*1i - a^2)) - (B*log(a + b*tan(c + d*x))*(a^2 - b^2))/(a*d*(a^2 + b^2))